<?php
/**
 * Created by litong on Date: 2019/2/24 0024 下午 7:50
 * 创建mysql数据库,面向过程
 */
$host="localhost";
$username="root";
$password="";
$connection = mysqli_connect($host, $username, $password);
if(!$connection){
  die("连接创建失败:".mysqli_connect_error().PHP_EOL);
}
$sql="create database database1";
if(mysqli_query($connection,$sql)){
  echo "数据库创建成功".PHP_EOL;
}else{
  echo "数据库创建失败".mysqli_error($connection).PHP_EOL;
}
mysqli_close($connection);